package org.jili.novoland.util;

import org.jili.novoland.R;

import android.app.Activity;
import android.graphics.BitmapFactory;
import android.view.Display;

public class Cfg {
    static private int viewWidth = 800;
    static private int viewHeight = 480;
    static private float scaleRate = 1.5f;
    static private int tileWidth = 32;
    static private int tileHeight = 32;
    static private int titleItemWidth = 64;

    public static int getTitleItemWidth() {
        return titleItemWidth;
    }

    public static int getTitleItemHeight() {
        return titleItemHeight;
    }

    static private int titleItemHeight = 32;

    public static int getTileWidth() {
        return tileWidth;
    }

    public static int getTileHeight() {
        return tileHeight;
    }

    public static int getViewWidth() {
        return viewWidth;
    }

    public static int getViewHeight() {
        return viewHeight;
    }

    public static float getScaleRate() {
        return scaleRate;
    }

    public static void setConfiguration(Activity activity) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        Cfg.viewHeight = display.getHeight();
        Cfg.viewWidth = display.getWidth();
        scaleRate = ((float) BitmapFactory.decodeResource(activity.getResources(), R.drawable.icon).getWidth()) / 32f;
        Cfg.tileWidth = (int) (Cfg.tileWidth * scaleRate);
        Cfg.tileHeight = (int) (Cfg.tileHeight * scaleRate);
        Cfg.titleItemHeight = (int) (Cfg.titleItemHeight * scaleRate);
        Cfg.titleItemWidth = (int) (Cfg.titleItemWidth * scaleRate);
    }
}
